(:
  A procedure to only return items if they are the last to have a certain set of infovalues
  (compulsory to two because I can't be bothered with recursion)
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;


<display>{

let $i1 := $arguments[2]
let $i2 := $arguments[3]
let $i3 := $arguments[4]
let $t := $arguments[1]

for $item in doc($t)/display/item 
let $v1 := jj:get-info($item,$i1)
let $v2 := jj:get-info($item,$i2)
let $v3 := jj:get-info($item,$i3)
let $similar := $item/following-sibling::item[jj:get-info(.,$i1) = $v1]
																							[jj:get-info(.,$i2) = $v2]
																							[jj:get-info(.,$i3) = $v3]
																							[1]
	return 
		if (fn:empty($similar)) then $item
		else ()

}</display>
